﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Common.DBOper
{

        public class Cls_SigSet
        {
            public int Id;
            public string SigType;
            public string SigUnit;
            public string Sensitivity;
            public string SensitivityUnit;
            public string SigName;
       }

        public class OperateSigSet
      {

            public List<Cls_SigSet> GetSigSetList()
            {
                List<Cls_SigSet> sigSetlist = new List<Cls_SigSet>();
                string connString = string.Format(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0} ;Persist Security Info=False;Jet OLEDB:Database Password={1}", System.Windows.Forms.Application.StartupPath + "\\DB.mdb", Mdl_Class.AccessPassWord);
                using (MyDb_Access mydb = new MyDb_Access(connString))
                {

                    try
                    {
                        mydb.Open();
                        string sql = "select * from T_SigSet where Id>0 order by Id";

                        mydb.ExecuteReader(sql);
                        while (mydb.DataReader.Read())
                        {
                           Cls_SigSet clssigset = new Cls_SigSet();

                        clssigset.Id = Convert.ToInt32(mydb.DataReader["Id"]);

                        clssigset.SigType = mydb.DataReader["SigType"].ToString();
                        clssigset.SigUnit = mydb.DataReader["SigUnit"].ToString();
                        clssigset.Sensitivity = mydb.DataReader["Sensitivity"].ToString();
                        clssigset.SensitivityUnit = mydb.DataReader["SensitivityUnit"].ToString();
                        clssigset.SigName = mydb.DataReader["SigName"].ToString();
                        sigSetlist.Add(clssigset);
                        }

                        mydb.Close();
                    }
                    catch (Exception ex)
                    {
                    sigSetlist = null;
                        Mdl_Class.WriteLog.dbErrLog("List<Cls_SigSet> GetSigSetList()", ex.ToString());
                    }
                    return sigSetlist;
                }
            }
       
    }
}
